﻿using MediatR;
using RBAC.Domain;
using RBAC.Domain.Service.Interfae;
using RBACDuYaJun.Api.Appliction.Command.RoleCommand;

namespace RBACDuYaJun.Api.Appliction.CommandHandlers.RoleHanders
{
    public class RoleShowCommandHandler : IRequestHandler<RoleShowCommand, PageDto<Roles>>
    {
        private readonly IRoleService _roleService;
        public RoleShowCommandHandler(IRoleService roleService)
        {
            _roleService = roleService;
        }

        public async Task<PageDto<Roles>> Handle(RoleShowCommand request, CancellationToken cancellationToken)
        {
            return await _roleService.GetRoleAsync(request.pageSize,request.pageIndex);
        }
    }
}
